package com.itheima01;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Test {
    public static void main(String[] args) throws SQLException {
        //获取连接池对象
        MyDataSource myDataSource = new MyDataSource();
        //获取连接对象
        Connection conn = myDataSource.getConnection();
        String sql="SELECT * FROM student";
        PreparedStatement pps = conn.prepareStatement(sql);
        ResultSet rs = pps.executeQuery();
        while (rs.next()){
            System.out.println(rs.getInt("sid")+"==="+rs.getString("name"));
        }
        rs.close();
        pps.close();
        conn.close();

    }
}
